perm filename SEQU[L70,TES] blob sn#009943 filedate 1972-06-27 generic text, type T, neo UTF8
00100		SEQUENCES
00200		---------
00300	
00400	A  "sequence"  is not a single entity but a certain kind of structure
00500	constructed from one or more entities.   A  sequence  always  has  at
00600	least  one  element, but for informal purposes, NIL may be thought of
00700	as the sequence of zero elements.
00800	
00900	S is a sequence iff FIRST(S) and REST(S) succeed.  NIL is not a  true
01000	sequence because FIRST(NIL) and REST(NIL) both FAIL.
01100	
01200	The  most  common  sequence is a non-empty LIST, for which FIRST(S) =
01300	CAR(S) and REST(S) = CDR(S).
01400	
01500	Two other standard sequences are CHARACTER FILE and TOKEN FILE.
01600	
01700	If CF is a CHARACTER FILE, then FIRST(S) is the  first  character  in
01800	the file and REST(S) is the file lacking that character.
01900	
02000	If  TF is a token file, then FIRST(TF) is the first token in the file
02100	and REST(TF) is the file lacking that token.  Both are  computed with
02200	the help of the current SCANNER(TF) function.
02300	
02400	The user may define other kinds of sequences by defining successful FIRST
02500	and REST functions for other types of entities.
02600	
02700	The following functions are defined for every sequence:
02800	
02900		NEXT(ref V) = FIRST(VALUE(V)) PROG1 V←REST(VALUE(V))
03000	
03100		EMPTY(S) = T iff S is a sequence, NIL otherwise
03200	
03300		LENGTH(S) = if EMPTY(S) then 0 else 1 + LENGTH(REST(S))
03400	
03500		FULL(S) = NOT EMPTY(S)
03600	
03700		TYPE(S) = the type of the entity that provides FIRST(S),
03800			e.g., if S is a list then PAIR; if S is a character
03900			file or token file then CHARFILE or TOKEFILE.